<!DOCTYPE html>
<html>

<head>
    <include file="Share:meta" />
    <script src="../Public/plugins/jsFormat/jsFormat.js"></script>
	<script src="../Public/plugins/citySelect/jsAddress.js"></script>
</head>

<body class="hold-transition skin-blue sidebar-mini">
    <div class="wrapper">
        <include file="Share:header" />
        <include file="Share:left" />
        <!-- Content Wrapper. Contains page content -->
        <div class="content-wrapper">
            <!-- Content Header (Page header) -->
            <section class="content-header">
                <h1>代理商账号管理<small></small></h1>
                <ol class="breadcrumb">
                    <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
                    <li class="active">代理商账号 新增、修改</li>
                </ol>
            </section>
            <!-- Main content -->
            <section class="content">
                <div class="box box-info">
                    <div class="box-header with-border">
                        <h3 class="box-title">
	                        <empty name="Think.get.uid">
	                        新增代理商
	                        <else />
	                        代理商详细信息
	                        <script type="text/javascript">
	                        	$(function(){
	                        		if({$Think.session.info.rid|default="0"} != 1){
	                        			$("input").attr('disabled','disabled');
	                        		}
	                        	});
	                        </script>
	                        </empty>
                        </h3>
                    </div>
                    <!-- /.box-header -->
                    <!-- form start -->
                    <form class="form-horizontal" action="" method="post">
                        <input type="hidden" name="uid" value="{$info.uid}"></input>
                        <div class="box-body">
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">名称</label>
                                <div class="col-sm-10">
                                    <input type="text" name="name" id="inputEventCode" class="form-control" value="{$info.name}" placeholder="" required="required" autocomplete="off">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">角色</label>
                                <div class="col-sm-10">
                                    <select name="rid" id="rid" class="form-control" required="required">
                                        <option></option>
                                        <volist name="addrole" id="vo">
                                            <option value="{$vo.roleid}">{$vo.rolename}</option>
                                        </volist>
                                    </select>
                                    <script type="text/javascript">
                                        $('#rid').val('{$info.rid}');
                                    </script>
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">所属上级</label>
                                <div class="col-sm-10">
                                    <select name="path" id="path" class="form-control">
                                        <option></option>
                                        <volist name="childrentree" id="vo">
                                            <eq name="vo.uid" value="$info.uid">
                                            <option value="{$vo.uid}" disabled="true">{$vo.space}{$vo.name}</option>
                                            <else/>
                                            <option value="{$vo.path}">{$vo.space}{$vo.name}</option>
                                            </eq>
                                        </volist>
                                    </select>
                                    <script type="text/javascript">
                                        $('#path').val('{$info.newpath}');
                                    </script>
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">业绩分成上级</label>
                                <div class="col-sm-10">
                                    <select name="puid" id="puid" class="form-control">
                                        <option></option>
                                        <volist name="childrentree" id="vo">
                                        	<eq name="vo.uid" value="$info.uid">
                                            <option value="{$vo.uid}" disabled="true">{$vo.space}{$vo.name}</option>
                                            <else/>
                                        	<option value="{$vo.uid}">{$vo.space}{$vo.name}</option>
                                            </eq>
                                        </volist>
                                    </select>
                                    <script type="text/javascript">
                                        $('#puid').val('{$info.puid}');
                                    </script>
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">邀请人</label>
                                <div class="col-sm-10">
                                    <select name="invite_uid" id="invite_uid" class="form-control">
                                        <option></option>
                                        <volist name="childrentree" id="vo">
                                        	<eq name="vo.uid" value="$info.uid">
                                            <option value="{$vo.uid}" disabled="true">{$vo.space}{$vo.name}</option>
                                            <else/>
                                        	<option value="{$vo.uid}">{$vo.space}{$vo.name}</option>
                                            </eq>
                                        </volist>
                                    </select>
                                    <script type="text/javascript">
                                        $('#invite_uid').val('{$info.invite_uid}');
                                    </script>
                                </div>
                            </div>
                            
                            
                            
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">登录账号</label>
                                <div class="col-sm-10">
                                    <input type="text" name="username" id="inputEventCode" class="form-control" value="{$info.username}" placeholder="" required="required" autocomplete="off">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">密码</label>
                                <div class="col-sm-10">
                                    <eq name="info.password" value="">
                                        <input type="password" name="password" id="inputEventCode" class="form-control" value="" placeholder="" required="required" autocomplete="off">
                                    <else/>
                                        <input type="password" name="password" id="inputEventCode" class="form-control" value="" placeholder="不修改密码请勿填写" autocomplete="off">
                                    </eq>
                                    
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">省/市/县</label>
                                <div class="col-sm-10">
                                    <div id="city">
                                        <div class="col-sm-4 npl">
                                            <select name="province" id="proviceId" class="form-control" required="required">
                                                <option value=""></option>
                                            </select>
                                        </div>
                                        <div class="col-sm-4">
                                            <select name="city" id="cityId" class="form-control" required="required">
                                                <option value=""></option>
                                            </select>
                                        </div>
                                        <div class="col-sm-4 npr">
                                            <select name="distinct" id="districtId" class="form-control" required="required">
                                                <option value=""></option>
                                            </select>    
                                        </div>   
                                    </div>
                                    
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">地址</label>
                                <div class="col-sm-10">
                                    <input type="text" name="address" id="inputEventCode" class="form-control" value="{$info.address}" placeholder="" autocomplete="off">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">联系人</label>
                                <div class="col-sm-10">
                                    <input type="text" name="contacts" id="inputEventCode" class="form-control" value="{$info.contacts}" autocomplete="off">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">手机</label>
                                <div class="col-sm-10">
                                    <input type="text" name="mobile" id="inputEventCode" class="form-control" value="{$info.mobile}" autocomplete="off" required="required">
                                </div>
                            </div>
                            
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">状态</label>
                                <div class="col-sm-10">
                                    <select name="status" id="status" class="form-control" required="required">
                                        <option value="1">正常</option>
                                        <option value="0">禁用</option>
                                        <option value="-1">删除</option>
                                    </select>
                                </div>
                                <script type="text/javascript">
                                    $("#status").val('{$info.status}');
                                </script>
                            </div>

                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">业绩考核</label>
                                <div class="col-sm-10">
                                    <select name="orderStatus" id="orderStatus" class="form-control" required="required">
                                        <option value="1">不需要</option>
                                        <option value="0">需要考核</option>
                                    </select>
                                </div>
                                <script type="text/javascript">
                                    $("#orderStatus").val('{$info.orderStatus}');
                                </script>
                            </div>
                            
                            <eq name="info" value="">
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-2 control-label">短信验证码</label>
                                <div class="col-sm-2">
                                    <input type="text" name="mobileverify" id="mobileverify" class="form-control" value="" autocomplete="off" required="required" >
                                </div>
                                <div class="col-sm-2">
                                	<button type="button" class="btn btn-info" id="verifybutton" onClick="sendmobileverify()" rel="1" data-time="60">发送验证码</button>
                                </div>
                            </div>
                            </eq>
                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer col-sm-offset-2">
                            <button type="submit" class="btn btn-primary">
                                <eq name="info" value="">新增
                                    <else />保存</eq>
                            </button>
                            <a class="btn btn-warning" href="__APP__/Admin/Store/slist" role="button">返回</a>
                        </div>
                        <br>
                        <!-- /.box-footer -->
                    </form>
                </div>
              
            </section>
            <!-- /.content -->
        </div>
        <!-- /.content-wrapper -->
        <include file="Share:copyright" />
        <include file="Share:setting" />
    </div>
    <include file="Share:js" />
<script type="text/javascript">
$("#AdminManager").addClass("active");
$("#store_list").addClass("active");

function sendmobileverify() {
	var cur = $("#verifybutton");
	if(cur.attr('rel')==1) {
		$.get("__APP__/Admin/ajax/sendmobileverify",{},function(result){
			if(result.data!="") {
				alert(result.data);
			}
			if(result.status==1) {
				cur.attr('rel',0);
				timelow();
			}
		});
	}
}
function timelow() {
	cur = $("#verifybutton");
	shijian = cur.attr("data-time");
	
	shijian = shijian-1;
	if(shijian<=0) {
		cur.html("发送验证码");
		cur.attr('data-time',60);
		cur.attr('rel',1);
		return false;
	}else{
		cur.html(shijian+"秒后重新获取");
		cur.attr("data-time",shijian);
		setTimeout("timelow()",1000);
	}
}

$(function() {
	addressInit('proviceId', 'cityId', 'districtId', '{$info.province}', '{$info.city}', '{$info.distinct}');
});
</script>    
    
</body>

</html>
